<template>
  <select v-if="isShow" @change="handleChange">
    <option value="">{{defaultTitle}}</option>
    <option 
      v-for="(info, name) in provinces"
      :value="`${info[codeKey]}:${info[codeName]}`"
    >{{name}}</option>
  </select>
</template>
<script>
export default {
  props: {
    isShow: {
      type: Boolean,
      default: false,
    },
    defaultTitle: {
      type: String,
      default: "请选择"
    },
    codeKey: String,
    codeName: String,
    provinces: {
      type: Object,
      defautl: () => {}
    }
  },
  methods: {
    handleChange(e) {
      this.$emit("handleChange", e);
    }
  }
}
</script>